﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ttapi_impl_win.impl.Audio
{
    internal class Format
    {
        //public static string ReadFourCc(BinaryReader reader, bool bigEndian = false)
        //{
        //    var a = reader.ReadChar();
        //    var b = reader.ReadChar();
        //    var c = reader.ReadChar();
        //    var d = reader.ReadChar();

        //        : new string(new[] { a, b, c, d });
        //}
        //var fourcc = stream.ReadFourCc();
        //                stream.Seek(0, SeekOrigin.Begin);

        //                if (fourcc.SequenceEqual(MakeFourCC("RIFF")))
        //                {
        //                    _decoder = new WaveDecoder(stream);
        //                    IsStreamed = false;
        //                }
        //                else if (fourcc.SequenceEqual(MakeFourCC("ID3\u0001")) ||
        //                         fourcc.SequenceEqual(MakeFourCC("ID3\u0002")) ||
        //                         fourcc.SequenceEqual(MakeFourCC("ID3\u0003")) ||
        //                         fourcc.AsSpan(0, 2).SequenceEqual(new byte[] { 0xFF, 0xFB }))
        //                {
        //                    _decoder = new Mp3Decoder(stream);
        //                    IsStreamed = true;
        //                }
        //                else if (fourcc.SequenceEqual(MakeFourCC("OggS")))
        //                {
        //                    _decoder = new VorbisDecoder(stream);
        //                    IsStreamed = true;
        //                }
        //                else
        //                {
        //                    throw new Exception("unknown format.");
        //                }
    }
}
